package com.chapter1;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class test5 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        int num = in.nextInt();
        int l = in.nextInt();
        int r = in.nextInt();
        list = solution(num,list);
        int[] arr = new int[list.size()];
        for(int i = 0; i < arr.length; i++){
            arr[i] = list.get(i);
        }
        int sum = 0;
        for(int i = l; i <= r; i++){
            if(arr[i] == 1){
                sum++;
            }
        }
        System.out.println(sum);
    }

    public static List<Integer> solution(int num, List<Integer> list){
        if(num == 1){
            return list;
        }
        if(num > 1){
            list.add((int)(num/2));
            solution((int)(num/2), list);
            list.add(num%2);
            solution(num%2, list);
            list.add((int)(num/2));
            solution((int)(num/2), list);
        }
        return list;
    }
}
